package com.enation.app.javashop.core.client.fallback.member;

import com.enation.app.javashop.core.client.feignimpl.member.ShipTemplateClientFeignImpl;
import com.enation.app.javashop.core.handler.BaseFallbackFactory;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.enation.app.javashop.model.shop.vo.ShipTemplateVO;
import org.springframework.stereotype.Component;

import java.util.List;

/**
 * 店铺运费模版相关熔断fallback factory
 * @author kingapex
 * @version 1.0
 * @data 2022/5/28 14:26
 **/
@Component
public class ShipTemplateClientFallbackFactory extends BaseFallbackFactory<ShipTemplateClientFeignImpl> {
    @Override
    protected ShipTemplateClientFeignImpl fallback() {
        return new ShipTemplateClientFallback();
    }

    /**
     * 店铺运费模版相关熔断
     *
     * @author zh
     * @version v7.0
     * @date 18/9/27 下午4:21
     * @since v7.0
     */
    @Component
    public static class ShipTemplateClientFallback implements ShipTemplateClientFeignImpl {

        private final Logger logger = LoggerFactory.getLogger(getClass());

        @Override
        public ShipTemplateVO get(Long id) {
            logger.error("根据id获取运费模板错误");
            return null;
        }

        @Override
        public List<String> getScripts(Long id) {

            logger.error("获取某运费模板脚本错误");
            return null;
        }

        @Override
        public void cacheShipTemplateScript(ShipTemplateVO shipTemplateVO) {
            logger.error("缓存中查询运费模版错误");
        }
    }
}
